<?php $this->load->view('admin/head.php'); ?>
<!--/sidebar-->
<div class="main-wrap">

    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="<?php echo site_url()?>/admin_login/check">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="<?php echo site_url('admin/recommend/index')?>">推荐游戏列表</a><span class="crumb-step">&gt;</span><span>修改</span></div>
    </div>
    <div class="result-wrap">
        <div class="result-content">
            <form action="<?php echo site_url('admin/recommend/process_update/')?>" method="post" id="myform" name="myform" enctype="multipart/form-data">
                <table class="insert-tab" width="100%">
                    <tbody>
                    <tr>
                        <th><i class="require-red">*</i>标题：</th>
                        <td>
                            <input type="hidden" name="id" id="id" value="<?php echo $view['id']; ?>" />
                            <input class="common-text required" id="title" name="title" size="50" value="<?php echo $view['title']; ?>" type="text">
                        </td>
                    </tr>
                    <tr>
                        <th width="150"><i class="require-red">*</i>分类：</th>
                        <td>
                            <?php if(!empty($category)){ ?>
                                <select name="category_id" id="category_id" class="required">
                                    <?php foreach($category as $key=>$val){?>
                                        <option value="<?php echo $val['id']; ?>" <?php if($view['category_id']==$val['id']){ echo 'selected="true"';} ?>><?php echo $val['title']; ?></option>
                                    <?php } ?>
                                </select>
                            <?php } ?>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>游戏描述：</th>
                        <td>
                            <script type="text/javascript" charset="utf-8" src="<?php echo base_url('ueditor/ueditor.config.js')?>"></script>
                            <script type="text/javascript" charset="utf-8" src="<?php echo base_url('ueditor/ueditor.all.min.js')?>"> </script>
                            <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
                            <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
                            <script type="text/javascript" charset="utf-8" src="<?php echo base_url('ueditor/lang/zh-cn/zh-cn.js')?>"></script>
                            <script id="container" name="description" type="text/plain" style="width:1024px;height:500px;">
                                <?php echo $view['description']?>
                        </script>
                            <script type="text/javascript">
                                //实例化编辑器
                                //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
                                var ue = UE.getEditor('container');
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>游戏链接地址：</th>
                        <td>
                            <input class="common-text required" id="url" name="url" size="50" value="<?php echo $view['url']; ?>" type="text">
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>效果图：</th>
                        <td>
                            <?php if($images){ ?>
                            <ul>
                                <?php foreach($images as $k=>$v){?>
                                <li><img width='100' src='<?= base_url().$v['picture']?>' /></li>
                                <?php } ?>
                            </ul>
                            <?php } ?>
                            <a href="<?php echo site_url('admin/recommend/image_add/'.$view['id'])?>"><i class="icon-font"></i>新增图片</a>
                        </td>
                    </tr>

                    <tr>
                        <th width="150"><i class="require-red">*</i>状态：</th>
                        <td>
                            <select name="status" id="status" class="required">
                                <option value="0" <?php if($view['status']==0){ echo 'selected="true"';} ?>>正常</option>
                                <option value="1" <?php if($view['status']==1){ echo 'selected="true"';} ?>>下架</option>
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <th width="150"><i class="require-red">*</i>操作系统：</th>
                        <td>
                            <select name="type" id="type" class="required" onchange="system();">
                                <option value="1" <?php if($view['type']==1){ echo 'selected="true"';} ?>>android</option>
                                <option value="2" <?php if($view['type']==2){ echo 'selected="true"';} ?>>ios</option>
                                <option value="3" <?php if($view['type']==3){ echo 'selected="true"';} ?>>windows</option>
                            </select>
                        </td>
                    </tr>
                    <tr style="display: none;" id="str">
                        <th width="150"><i class="require-red">*</i>下载状态：</th>
                        <td>
                            <select name="breakid" id="breakid" class="required">
                                <option value="1" <?php if($view['breakid']==1){ echo 'selected="true"';} ?>>越狱</option>
                                <option value="2" <?php if($view['breakid']==2){ echo 'selected="true"';} ?>>限免</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>下载大小：</th>
                        <td>
                            <input class="common-text required" id="size" name="size" size="50" value="<?php echo $view['size']; ?>" type="text">
                            单位：M
                        </td>
                    </tr>

                    <tr>
                        <th><i class="require-red">*</i>排序：</th>
                        <td>
                            <input class="common-text required" id="sort" name="sort" size="50" value="<?php echo $view['sort']; ?>" type="text">
                            排序填写数字，最大的排序在前面
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>图片：</th>
                        <td>
                            <input type="file" name="picture" />
                            <img width='40px' src='<?= base_url().$view['picture']?>' />
                        </td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                            <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                        </td>
                    </tr>
                    </tbody></table>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        function system(){
            var type = $('#type').val();

            if(type == 2){
                $('#str').css('display','');
            }else{
                $('#str').css('display','none');
            }
        }
    </script>
</div>
<!--/main-->
</div>
</body>
</html>